<?php
/**
 * Niushop商城系统 - 团队十年电商经验汇集巨献!
 * =========================================================
 * Copy right 2019-2029 上海牛之云网络科技有限公司, 保留所有权利。
 * ----------------------------------------------
 * 官方网址: https://www.niushop.com
 * =========================================================
 */


namespace app\event;

use app\model\member\Member;
use app\model\order\OrderRefund as OrderRefundModel;

/**
 * 订单自动收货
 */
class CronRefundOrderTakeDelivery
{
    // 行为扩展的执行入口必须是run
    public function handle($data)
    {
        $order_goods = model('order_goods')->getInfo(['order_goods_id'=>$data['relate_id']],'member_id,order_goods_id');
        $order_refund_model = new OrderRefundModel();
        $member_model = new Member();
        $member_info_result = $member_model->getMemberInfo([ [ "member_id", "=", $order_goods['member_id'] ] ]);
        $member_info = $member_info_result[ "data" ];
        //$order_goods_id = isset($this->params[ 'order_goods_id' ]) ? $this->params[ 'order_goods_id' ] : '0';
        $data = array (
            "order_goods_id" => $data['relate_id'],
        );
        $res = $order_refund_model->orderTakeDelivery($data,$member_info);
        return $res;
    }

}